//
//  GSServerManager.h
//  AgileNYC
//
//  Created by German Sidorenko on 09.05.14.
//  Copyright (c) 2014 Softlegion. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "GSUser.h"
#import "SGSServerManagerConsts.h"

typedef void(^GSCompletionBlock)(BOOL isSuccess, NSError * error, NSInteger statusCode);


@interface SGSServerManager : NSObject

+(SGSServerManager*) sharedManager;

#pragma mark - - Tokenless Operations - -

#pragma mark - Events List

-(void) getEventsList:(NSString*) currentUserToken
               offcet:(NSInteger) offset
                count:(NSInteger) count
            onSuccess:(void(^)(NSArray * arrayWithDictionaryOfEvents)) success
            onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) checkInOnEvent:(NSString*) currentUserToken
               eventID:(NSNumber*) eventID
                  flag:(BOOL) flag
            onSuccess:(void(^)()) success
            onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) rateEvent:(NSString*) currentUserToken
          eventID:(NSNumber*) eventID
           rating:(NSNumber*) rating
        onSuccess:(void(^)(NSDictionary * eventInfo)) success
        onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

#pragma mark - User operation

-(void) checkEmail: (NSString*) eMail
        onSuccess:(void(^)(BOOL result)) success
        onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(BOOL) loginUser: (NSString*) eMail
         password: (NSString*) password
       socialType: (GSLoginType) socialType
      deviceToken: (NSString*) deviceToken
        onSuccess:(void(^)(NSDictionary * userInfo, NSString * errorString)) success
        onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(BOOL) createUser: (NSString*) eMail
          password: (NSString*) password
        socialType: (GSLoginType) socialType
       deviceToken: (NSString*) deviceToken
             onSuccess:(void(^)(NSDictionary * userInfo)) success
             onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) getUserInfo:(NSString*) currentUserToken
          onSuccess:(void(^)(NSDictionary * dictionaryOfUser)) success
          onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) postUserInfo:(NSString*) currentUserToken
         dictOfUser:(NSDictionary*) dictOfUser
          onSuccess:(void(^)(void)) success
          onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) postUserImage:(NSString*) currentUserToken
          imageOfUser:(NSData*) imageOfUser
            onSuccess:(void(^)(NSString * newURL)) success
            onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) getUserImage:(NSString*) currentUserToken
              userID:(NSNumber*) userID
            onSuccess:(void(^)(NSData * userImage)) success
            onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) deleteUserImage:(NSString*) currentUserToken
              onSuccess:(void(^)(void)) success
              onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;


#pragma mark - Connection to another user

-(void) sendConnection:(NSString*) currentUserToken
          toUserID:(NSNumber*) anotherUserID
           onSuccess:(void(^)(void)) success
           onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) checkConnection:(NSString*) currentUserToken
              onSuccess:(void(^)(NSDictionary * arrayWithDictionaryOfRequestors)) success
              onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) sendConnectionReply:(NSString*) currentUserToken
                   toUserID:(NSNumber*) anotherUserID
                      reply:(BOOL) reply
                  onSuccess:(void(^)(void)) success
                  onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) deleteContact:(NSString*) currentUserToken
               userID:(NSNumber*) userID
            onSuccess:(void(^)(void)) success
            onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) getContactsList:(NSString*) currentUserToken
                 offcet:(NSInteger) offset
                  count:(NSInteger) count
              onSuccess:(void(^)(NSArray * arrayWithDictionaryOfContacts)) success
              onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

-(void) saveNotesForContact:(NSString*) currentUserToken
                   toUserID:(NSNumber*) anotherUserID
                      notes:(NSString*) notes
                  onSuccess:(void(^)(void)) success
                  onFailure:(void(^)(NSError * error, NSInteger statusCode)) failure;

@end
